/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Control.Control;
import DataBase.ServicioMenu;
import Logic.Filtro;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author David-PC
 */
public class GUI_Logminer extends javax.swing.JPanel {

    /**
     * Creates new form LogminerGUI
     */
    Control control = Control.getInstance();

    public GUI_Logminer() {
        initComponents();
        
        serverTF.setText(control.getSELECTED_SERVER());
        loadUsers();
        loadTables();
        progressBar.setStringPainted(true);
        fechaDesde.setEditor(new JSpinner.DateEditor(fechaDesde, Filtro.dateFormatString));
        fechaHasta.setEditor(new JSpinner.DateEditor(fechaHasta, Filtro.dateFormatString));
        this.userTable.getTableHeader().setReorderingAllowed(false);
        this.tablesTable.getTableHeader().setReorderingAllowed(false);
        this.logminerTable.getTableHeader().setReorderingAllowed(false);
    }

    public JLabel getRowSelectedLabel() {
        return rowSelectedLabel;
    }

    public JProgressBar getProgressBar() {
        return progressBar;
    }

    public JButton getStartButton() {
        return startButton;
    }

    public JLabel getRowsLabel() {
        return rowsLabel;
    }

    public JLabel getStatusLabel() {
        return jLabel2;
    }

    public JTable getLogminerTable() {
        return logminerTable;
    }

    public void clearTable(JTable jtable) {
        while (jtable.getRowCount() > 0) {
            ((DefaultTableModel) jtable.getModel()).removeRow(0);
        }
    }

    public void loadUsers() {
        clearTable(userTable);
        ServicioMenu sm = control.getServicioMenu();
        ArrayList<String> list = (ArrayList<String>) sm.listarUsers();

        Iterator ite = list.iterator();
        while (ite.hasNext()) {
            ((DefaultTableModel) this.userTable.getModel()).addRow(new Object[]{ite.next(), false});
        }

    }

    public void loadTables() {
        ArrayList list;
        ServicioMenu sm = control.getServicioMenu();
        list = (ArrayList) sm.allTables();
        
        for (int i = 0; i < list.size(); i++) {
            String ser = list.get(i).toString();
            ((DefaultTableModel) tablesTable.getModel()).addRow(new Object[]{ser, false});
        }

        /*Iterator ite = list.iterator();
        while (ite.hasNext()) {
            ((DefaultTableModel) tablesTable.getModel()).addRow(new Object[]{ite.next(), false});
            ite.next();
        }*/
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        allTableCB = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        tablesTable = new javax.swing.JTable();
        checkRulesCB = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        serverTF = new javax.swing.JTextField();
        allDatesCB = new javax.swing.JCheckBox();
        allUsersCB = new javax.swing.JCheckBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        userTable = new javax.swing.JTable();
        startButton = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        insertCB = new javax.swing.JCheckBox();
        deleteCB = new javax.swing.JCheckBox();
        updateCB = new javax.swing.JCheckBox();
        fechaDesde = new javax.swing.JSpinner();
        fechaHasta = new javax.swing.JSpinner();
        jLabel1 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        logminerTable = new javax.swing.JTable();
        progressBar = new javax.swing.JProgressBar();
        rowsLabel = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        rowSelectedLabel = new javax.swing.JLabel();

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Filter"));

        allTableCB.setText("All Tables");
        allTableCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                allTableCBActionPerformed(evt);
            }
        });

        tablesTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tables", "..."
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tablesTable);
        tablesTable.getColumnModel().getColumn(1).setMinWidth(30);
        tablesTable.getColumnModel().getColumn(1).setPreferredWidth(30);
        tablesTable.getColumnModel().getColumn(1).setMaxWidth(30);

        checkRulesCB.setText("Check  Rules");
        checkRulesCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkRulesCBActionPerformed(evt);
            }
        });

        jLabel4.setText("Server:");

        serverTF.setEditable(false);
        serverTF.setText("unknow");

        allDatesCB.setText("All Dates");
        allDatesCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                allDatesCBActionPerformed(evt);
            }
        });

        allUsersCB.setText("All Users");
        allUsersCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                allUsersCBActionPerformed(evt);
            }
        });

        userTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Users", "..."
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                false, true
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(userTable);
        userTable.getColumnModel().getColumn(1).setMinWidth(30);
        userTable.getColumnModel().getColumn(1).setPreferredWidth(30);
        userTable.getColumnModel().getColumn(1).setMaxWidth(30);

        startButton.setBackground(new java.awt.Color(102, 153, 255));
        startButton.setText("Start");
        startButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                startButtonActionPerformed(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Operation"));

        insertCB.setText("INSERT");

        deleteCB.setText("DELETE");
        deleteCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteCBActionPerformed(evt);
            }
        });

        updateCB.setText("UPDATE");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(insertCB)
                    .addComponent(deleteCB)
                    .addComponent(updateCB))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(insertCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(deleteCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(updateCB))
        );

        fechaDesde.setModel(new javax.swing.SpinnerDateModel(new java.util.Date(), null, null, java.util.Calendar.MINUTE));

        fechaHasta.setModel(new javax.swing.SpinnerDateModel(new java.util.Date(), null, null, java.util.Calendar.MINUTE));

        jLabel1.setText("From:");

        jLabel5.setText("To:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(checkRulesCB)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(startButton, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(allDatesCB, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(allTableCB)
                                    .addComponent(allUsersCB)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(jPanel1Layout.createSequentialGroup()
                                                    .addComponent(jLabel4)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                    .addComponent(serverTF, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(jPanel1Layout.createSequentialGroup()
                                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel1)
                                                        .addComponent(jLabel5))
                                                    .addGap(18, 18, 18)
                                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                        .addComponent(fechaDesde, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
                                                        .addComponent(fechaHasta))))
                                            .addGap(18, 18, 18)
                                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(serverTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(fechaDesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(fechaHasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(allDatesCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(allUsersCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(allTableCB)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(startButton)
                    .addComponent(checkRulesCB)))
        );

        logminerTable = new javax.swing.JTable(){
            public boolean isCellEditable(int rowIndex, int colIndex) {
                return false; //Disallow the editing of any cell
            }
        };
        logminerTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Username", "Operation", "Tablespace", "Table", "SQL Instruction"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        logminerTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                logminerTableMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(logminerTable);
        logminerTable.getColumnModel().getColumn(0).setPreferredWidth(70);
        logminerTable.getColumnModel().getColumn(1).setPreferredWidth(60);
        logminerTable.getColumnModel().getColumn(2).setPreferredWidth(40);
        logminerTable.getColumnModel().getColumn(5).setPreferredWidth(100);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 533, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rowsLabel)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(rowSelectedLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rowsLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(progressBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(rowSelectedLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void checkRulesCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkRulesCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkRulesCBActionPerformed

    private void allUsersCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allUsersCBActionPerformed
        if(allUsersCB.isSelected()){
            for(int i=0;i<userTable.getRowCount();i++){
                userTable.getModel().setValueAt(true, i,1);
            }
            userTable.setEnabled(false);
        }
        else{
            for(int i=0;i<userTable.getRowCount();i++){
                userTable.getModel().setValueAt(false, i,1);
            } 
            userTable.setEnabled(true);
        }
    }//GEN-LAST:event_allUsersCBActionPerformed

    private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed
     if(this.insertCB.isSelected() || this.deleteCB.isSelected() || this.updateCB.isSelected()){
        ArrayList<String> usuarios = new ArrayList();
        for (int i = 0; i < userTable.getRowCount(); i++) {
            if ((boolean) userTable.getModel().getValueAt(i, 1)) {
                usuarios.add((String) userTable.getModel().getValueAt(i, 0));
            }
        }
        ArrayList<String> tablas = new ArrayList();
        for (int i = 0; i < tablesTable.getRowCount(); i++) {
            if ((boolean) tablesTable.getModel().getValueAt(i, 1)) {
                tablas.add((String) tablesTable.getModel().getValueAt(i, 0));
            }
        }

        ArrayList<String> opers = new ArrayList();
        if (insertCB.isSelected()) {
            opers.add("INSERT");
        }
        if (deleteCB.isSelected()) {
            opers.add("DELETE");
        }
        if (updateCB.isSelected()) {
            opers.add("UPDATE");
        }


        Filtro filtro = new Filtro(
                allDatesCB.isSelected(),
                false,
                allTableCB.isSelected(),
                allUsersCB.isSelected(),
                checkRulesCB.isSelected(),
                opers,
                (Date) fechaDesde.getValue(),
                (Date) fechaHasta.getValue(),
                usuarios,
                tablas);
        if (checkRulesCB.isSelected()) {
            GUI_SelectRule slct = new GUI_SelectRule(filtro, this);
            slct.setVisible(true);
        } else {
            GUI_AddArchive add = new GUI_AddArchive(filtro, this,null);
            add.setVisible(true);
        }
     }else{
         JOptionPane.showMessageDialog(this, "You must choose an operation.", "Input Error", JOptionPane.ERROR_MESSAGE);
     }
    }//GEN-LAST:event_startButtonActionPerformed

    private void deleteCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_deleteCBActionPerformed

    private void allDatesCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allDatesCBActionPerformed

    }//GEN-LAST:event_allDatesCBActionPerformed

    private void allTableCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allTableCBActionPerformed
        if(allTableCB.isSelected()){
            for(int i=0;i<tablesTable.getRowCount();i++){
                tablesTable.getModel().setValueAt(true, i,1);
            }
            tablesTable.setEnabled(false);
        }
        else{
            for(int i=0;i<tablesTable.getRowCount();i++){
                tablesTable.getModel().setValueAt(false, i,1);
            } 
            tablesTable.setEnabled(true);
        }
    }//GEN-LAST:event_allTableCBActionPerformed

    private void logminerTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_logminerTableMouseClicked
        if(evt.getClickCount()>=2){
            int columnSize = logminerTable.getModel().getColumnCount();
            String args[] = new String[columnSize];
            int index = logminerTable.getSelectedRow();
            for(int i=0;i<columnSize;i++){
                args[i] = (String)logminerTable.getValueAt(index, i);
            }
            
           GUI_LogminerView v = new GUI_LogminerView(args);
           v.setVisible(true);
        }
    }//GEN-LAST:event_logminerTableMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox allDatesCB;
    private javax.swing.JCheckBox allTableCB;
    private javax.swing.JCheckBox allUsersCB;
    private javax.swing.JCheckBox checkRulesCB;
    private javax.swing.JCheckBox deleteCB;
    private javax.swing.JSpinner fechaDesde;
    private javax.swing.JSpinner fechaHasta;
    private javax.swing.JCheckBox insertCB;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable logminerTable;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel rowSelectedLabel;
    private javax.swing.JLabel rowsLabel;
    private javax.swing.JTextField serverTF;
    private javax.swing.JButton startButton;
    private javax.swing.JTable tablesTable;
    private javax.swing.JCheckBox updateCB;
    private javax.swing.JTable userTable;
    // End of variables declaration//GEN-END:variables
}
